﻿@model UcAsp.Net.Model.AdvPositions
@{
    ViewBag.Title = Model.AdvChinaName;
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<script>
    tinymce.init({
        selector: "textarea",
        plugins: [
        "advlist autolink lists link image charmap print preview anchor",
        "searchreplace visualblocks code fullscreen",
        "insertdatetime media table contextmenu paste hr upfile"
        ],
        toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent |link image upfile"

    });
    $(function () {
        $(".saveadv").live("click", function () {
            var html = tinyMCE.get("AdvHtml").getContent();
            var adv = $("input[name='AdvPositionName']").val()
            var cid = $("input[name='id']").val()
            $.post("/admin/SaveAdv", { Theme: $("input[name='theme']").val(), AdvHtml: html, AdvChinaName: adv, AdvPositionName: adv, CId: cid @if (Request["Message"] != null)
            {<text>, Message: 'show'</text>} }, function () {


                window.location = "/Admin/AdvManage?theme=" + $("input[name='theme']").val() + "@if(!string.IsNullOrEmpty(Request["Message"])){<text>&Message=show</text>}&Id=" + cid;

            })
        })
    });
</script>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <div class="widget-box">
                <div class="widget-title">
                    <span class="icon"><i class="icon-th"></i></span>
                    <h5>内容编辑</h5>
                </div>
                <div class="widget-content nopadding">
                    <form action="#" method="post" class="form-horizontal">
                        <input name="AdvChinaName" type="hidden" value="@Model.AdvPositionName" />
                        <input name="id" type="hidden" value="@Request["id"]" />
                        <input name="Message" type="hidden" value="@Request["Message"]" />
                        <input name="theme" type="hidden" value="@Request["theme"]" />
                        <div class="control-group">
                            <label class="control-label">标题</label>
                            <div class="controls">
                                <input class="text-input large-input" type="text" id="AdvPositionName" name="AdvPositionName" value="@Model.AdvPositionName" />
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">内容</label>
                            <div class="controls">
                                <textarea id="AdvHtml" name="AdvHtml" cols="20" rows="6">@Model.AdvHtml</textarea>
                            </div>
                        </div>

                    </form>
                    <div class="control-group">
                        <div class="controls">
                            <span class="btn saveadv">保存</span>
                            <div class="alert alert-success" style="display:none">
                                <strong>成功！</strong>修改是成功的。
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

